<html>
<head><meta charset="utf-8"><title>-Z codegen-backend docs · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html">-Z codegen-backend docs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213258403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213258403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213258403">(Oct 14 2020 at 08:19)</a>:</h4>
<p>Related to the other topic. I couldn't find any tracking issue on GitHub or documentation in the unstable book for <code>-Z codegen-backend</code>.  Am I missing something or is there none? If none, does anyone mind if I make an issue and make a pr to the book?</p>



<a name="213260669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213260669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213260669">(Oct 14 2020 at 08:48)</a>:</h4>
<p>I don't think there is any documentation for it either. It basically works by exporting a function called <code>__rustc_codegen_backend</code> with a signature of <code>fn() -&gt; Box&lt;dyn CodegenBackend&gt;</code> from a dylib. You then pass the path to that dylib to <code>-Zcodegen-backend</code>.</p>



<a name="213261161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213261161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213261161">(Oct 14 2020 at 08:53)</a>:</h4>
<p>Do note that I moved cg_clif mostly away from <code>-Zcodegen-backend</code> to a custom driver as it is much more flexible. It for example allows me to add a new <code>--jit</code> argument. In the future it may also help with <a href="https://github.com/bjorn3/rustc_codegen_cranelift/issues/1087">bjorn3/rustc_codegen_cranelift#1087</a> (In-place binary/jit updating) by allowing me to pass the necessary bookkeeping data directly to the codegen backend.</p>



<a name="213263737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213263737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213263737">(Oct 14 2020 at 09:20)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> Interesting! I looked through the code, and if I understand correctly cg_clif is now the outer shell around rustc, <em>and</em> it's also available as a <a href="https://github.com/bjorn3/rustc_codegen_cranelift/blob/master/src/lib.rs#L343">backend to itself</a>?</p>



<a name="213265600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213265600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213265600">(Oct 14 2020 at 09:41)</a>:</h4>
<p>Correct. It supports both <code>-Zcodegen-backend</code> (currently only used for rustdoc) and as a custom rustc driver.</p>



<a name="213278505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213278505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213278505">(Oct 14 2020 at 12:08)</a>:</h4>
<p>Made a tracking issue. <a href="https://github.com/rust-lang/rust/issues/77933">https://github.com/rust-lang/rust/issues/77933</a></p>



<a name="213385093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/-Z%20codegen-backend%20docs/near/213385093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/-Z.20codegen-backend.20docs.html#213385093">(Oct 15 2020 at 06:42)</a>:</h4>
<p>Möbius compiler?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>